Left Termination of the query pattern normal_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

normal(F, N) :- ','(rewrite(F, F1), normal(F1, N)).
normal(F, F).
rewrite(op(op(A, B), C), op(A, op(B, C))).
rewrite(op(A, op(B, C)), op(A, L)) :- rewrite(op(B, C), L).

Queries:

normal(g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

NORMAL_IN(F, N) → U11(F, N, rewrite_in(F, F1))
NORMAL_IN(F, N) → REWRITE_IN(F, F1)
REWRITE_IN(op(A, op(B, C)), op(A, L)) → U31(A, B, C, L, rewrite_in(op(B, C), L))
REWRITE_IN(op(A, op(B, C)), op(A, L)) → REWRITE_IN(op(B, C), L)
U11(F, N, rewrite_out(F, F1)) → U21(F, N, normal_in(F1, N))
U11(F, N, rewrite_out(F, F1)) → NORMAL_IN(F1, N)

The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)
U31(x1, x2, x3, x4, x5)  =  U31(x1, x5)
U21(x1, x2, x3)  =  U21(x3)
REWRITE_IN(x1, x2)  =  REWRITE_IN(x1)
U11(x1, x2, x3)  =  U11(x3)
NORMAL_IN(x1, x2)  =  NORMAL_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

NORMAL_IN(F, N) → U11(F, N, rewrite_in(F, F1))
NORMAL_IN(F, N) → REWRITE_IN(F, F1)
REWRITE_IN(op(A, op(B, C)), op(A, L)) → U31(A, B, C, L, rewrite_in(op(B, C), L))
REWRITE_IN(op(A, op(B, C)), op(A, L)) → REWRITE_IN(op(B, C), L)
U11(F, N, rewrite_out(F, F1)) → U21(F, N, normal_in(F1, N))
U11(F, N, rewrite_out(F, F1)) → NORMAL_IN(F1, N)

The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)
U31(x1, x2, x3, x4, x5)  =  U31(x1, x5)
U21(x1, x2, x3)  =  U21(x3)
REWRITE_IN(x1, x2)  =  REWRITE_IN(x1)
U11(x1, x2, x3)  =  U11(x3)
NORMAL_IN(x1, x2)  =  NORMAL_IN(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 3 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REWRITE_IN(op(A, op(B, C)), op(A, L)) → REWRITE_IN(op(B, C), L)

The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)
REWRITE_IN(x1, x2)  =  REWRITE_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

REWRITE_IN(op(A, op(B, C)), op(A, L)) → REWRITE_IN(op(B, C), L)

R is empty.
The argument filtering Pi contains the following mapping:
op(x1, x2)  =  op(x1, x2)
REWRITE_IN(x1, x2)  =  REWRITE_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

REWRITE_IN(op(A, op(B, C))) → REWRITE_IN(op(B, C))

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

NORMAL_IN(F, N) → U11(F, N, rewrite_in(F, F1))
U11(F, N, rewrite_out(F, F1)) → NORMAL_IN(F1, N)

The TRS R consists of the following rules:

normal_in(F, F) → normal_out(F, F)
normal_in(F, N) → U1(F, N, rewrite_in(F, F1))
rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))
U1(F, N, rewrite_out(F, F1)) → U2(F, N, normal_in(F1, N))
U2(F, N, normal_out(F1, N)) → normal_out(F, N)

The argument filtering Pi contains the following mapping:
normal_in(x1, x2)  =  normal_in(x1)
normal_out(x1, x2)  =  normal_out(x2)
U1(x1, x2, x3)  =  U1(x3)
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U2(x1, x2, x3)  =  U2(x3)
U11(x1, x2, x3)  =  U11(x3)
NORMAL_IN(x1, x2)  =  NORMAL_IN(x1)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

NORMAL_IN(F, N) → U11(F, N, rewrite_in(F, F1))
U11(F, N, rewrite_out(F, F1)) → NORMAL_IN(F1, N)

The TRS R consists of the following rules:

rewrite_in(op(A, op(B, C)), op(A, L)) → U3(A, B, C, L, rewrite_in(op(B, C), L))
rewrite_in(op(op(A, B), C), op(A, op(B, C))) → rewrite_out(op(op(A, B), C), op(A, op(B, C)))
U3(A, B, C, L, rewrite_out(op(B, C), L)) → rewrite_out(op(A, op(B, C)), op(A, L))

The argument filtering Pi contains the following mapping:
rewrite_in(x1, x2)  =  rewrite_in(x1)
op(x1, x2)  =  op(x1, x2)
U3(x1, x2, x3, x4, x5)  =  U3(x1, x5)
rewrite_out(x1, x2)  =  rewrite_out(x2)
U11(x1, x2, x3)  =  U11(x3)
NORMAL_IN(x1, x2)  =  NORMAL_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ RuleRemovalProof

Q DP problem:
The TRS P consists of the following rules:

U11(rewrite_out(F1)) → NORMAL_IN(F1)
NORMAL_IN(F) → U11(rewrite_in(F))

The TRS R consists of the following rules:

rewrite_in(op(A, op(B, C))) → U3(A, rewrite_in(op(B, C)))
rewrite_in(op(op(A, B), C)) → rewrite_out(op(A, op(B, C)))
U3(A, rewrite_out(L)) → rewrite_out(op(A, L))

The set Q consists of the following terms:

rewrite_in(x0)
U3(x0, x1)

We have to consider all (P,Q,R)-chains.
By using the rule removal processor [15] with the following polynomial ordering [25], at least one Dependency Pair or term rewrite system rule of this QDP problem can be strictly oriented.
Strictly oriented dependency pairs:

U11(rewrite_out(F1)) → NORMAL_IN(F1)
NORMAL_IN(F) → U11(rewrite_in(F))


Used ordering: POLO with Polynomial interpretation [25]:

POL(NORMAL_IN(x1)) = 2 + 2·x1   
POL(U11(x1)) = 2·x1   
POL(U3(x1, x2)) = 2 + 2·x1 + x2   
POL(op(x1, x2)) = 2 + 2·x1 + x2   
POL(rewrite_in(x1)) = x1   
POL(rewrite_out(x1)) = 2 + x1   



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ RuleRemovalProof
QDP
                            ↳ PisEmptyProof

Q DP problem:
P is empty.
The TRS R consists of the following rules:

rewrite_in(op(A, op(B, C))) → U3(A, rewrite_in(op(B, C)))
rewrite_in(op(op(A, B), C)) → rewrite_out(op(A, op(B, C)))
U3(A, rewrite_out(L)) → rewrite_out(op(A, L))

The set Q consists of the following terms:

rewrite_in(x0)
U3(x0, x1)

We have to consider all (P,Q,R)-chains.
The TRS P is empty. Hence, there is no (P,Q,R) chain.